package com.chapter_8;

import java.util.Random;

/**
 * @Author: Timo
 * @Date: 2019/5/16 16:22
 * @Description: 请求类
 */
public class Request {
    /**
     * 委托者
     */
    private final String name;
    /**
     * 请求的编号
     */
    private final int number;

    private static final Random random = new Random();

    public Request(String name, int number) {
        this.name = name;
        this.number = number;
    }

    public void execute() {
        System.out.println(Thread.currentThread().getName()+ " executes " + this.toString());
    }

    @Override
    public String toString() {
        return "[Request from "+ name + "No."+ number + "]";
    }
}
